<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!-- 引入 JSTL 标签库 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>JSP - Hello World</title>

    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f7f9fc;
            margin: 0;
            padding: 0;
        }

        header {
            background-color: #4CAF50;
            color: white;
            padding: 15px 0;
            text-align: center;
        }

        main {
            margin: 20px;
        }

        h1 {
            font-size: 2em;
            color: #333;
        }

        a {
            color: #4CAF50;
            text-decoration: none;
            margin: 5px 0;
            display: inline-block;
        }

        a:hover {
            text-decoration: underline;
        }

        .form-container {
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            padding: 20px;
            max-width: 400px;
            margin: auto;
        }

        .form-container label {
            font-weight: bold;
            margin-bottom: 5px;
            display: block;
        }

        .form-container input {
            width: 100%;
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        .form-container button {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            width: 100%;
        }

        .form-container button:hover {
            background-color: #45a049;
        }

        footer {
            text-align: center;
            margin-top: 30px;
            padding: 20px;
            background-color: #87CEEB;
            color: white;
        }

        /* 登录状态显示区域的样式 */
        .login-status {
            font-size: 1.2em;
            text-align: right;
            margin-right: 20px;
            margin-top: 10px;
        }

        @media (max-width: 600px) {
            .form-container {
                width: 100%;
                margin: 10px;
            }
        }
    </style>
</head>
<body>

<header>
    <h1>Welcome to JSP - Hello World</h1>
</header>

<main>
    <!-- 登录状态区域 -->
    <section class="login-status">
        <c:choose>

            <c:when test="${not empty sessionScope.username}">
                <p>Welcome, ${sessionScope.username}! <a href="logout">注销</a> </p>

            </c:when>

            <c:otherwise>
                <a href="html/login.html">登录</a>
            </c:otherwise>
        </c:choose>
    </section>
    <section>
        <h1><%= "Hello World!" %></h1>
        <nav>
            <a href="hello-servlet">Hello Servlet</a><br>
            <a href="first">测试两个Servlet之间传递信息</a><br>
            <a href="redirect">测试使用Servlet进行重定向</a><br>
            <a href="collection">测试Jsp中显示集合数据</a><br>
            <a href="user-map">测试Jsp中显示JavaBean集合数据</a><br>
        </nav>
    </section>



    <section>
        <h2>Submit Your Information</h2>
        <div class="form-container">
            <form action="submit" method="POST">
                <label for="name">Name:</label>
                <input type="text" id="name" name="name1" required>

                <label for="email">Email:</label>
                <input type="email" id="email" name="email" required>

                <button type="submit">Submit</button>
            </form>
        </div>
    </section>
</main>

<footer>
    <p>&copy; 2025 JSP Example. All rights reserved.</p>
</footer>

</body>
</html>
